﻿using Grow.Domain.EventBus.Cap.SubscriberDomainEvents;
using Grow.Domain.Repository;
using Grow.Module.Service;
using Grow.Scheduler.Job;

namespace Grow.Domain.EventBus.Cap.Jobs
{
    public class ExpirerSubscriberDomainEventJob : JobBase
    {
        private readonly ISubscriberDomainEventService _subscriberDomainEventService;
        public ExpirerSubscriberDomainEventJob(IServiceContext serviceContext) : base(serviceContext)
        {
            _subscriberDomainEventService = serviceContext.GetRequiredService<ISubscriberDomainEventService>();
        }

        public override async Task ExecuteAsync(CancellationToken cancellationToken)
        {
          await _subscriberDomainEventService.ExpirerSubscriberDomainEventAsync(cancellationToken);
        }
    }
}
